package com.leo.common.security.common.entity;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.User;
import java.io.Serializable;
import java.util.Collection;

/**
 * <p>
 * SecurityUser 实体类
 * </p>
 *
 * @author ：Leo
 * @since ：2021-04-06 14:58
 */
public class SecurityUser extends User implements Serializable {

	private static final long serialVersionUID = 1L;

	private Long id;

	private String realName;

	private String nickName;

	private String userType;

	private Integer tenantId;

	private String[] permissions;

	public String[] getPermissions() {
		return permissions;
	}

	public void setPermissions(String[] permissions) {
		this.permissions = permissions;
	}

	public String getNickName() {
		return nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	public Integer getTenantId() {
		return tenantId;
	}

	public void setTenantId(Integer tenantId) {
		this.tenantId = tenantId;
	}

	public SecurityUser(Long id, Integer tenantId, String username, String password, String userType, String realName,
			String nickName, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired,
			boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities) {
		super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
		this.id = id;
		this.tenantId = tenantId;
		this.userType = userType;
		this.realName = realName;
		this.nickName = nickName;
	}

	public SecurityUser(Long id, Integer tenantId, String username, String password, String userType, String realName,
			String nickName, Collection<? extends GrantedAuthority> authorities) {
		super(username, password, authorities);
		this.id = id;
		this.tenantId = tenantId;
		this.userType = userType;
		this.realName = realName;
		this.nickName = nickName;
	}

	public SecurityUser(Long id, Integer tenantId, String username, String password, String userType, String realName,
			String nickName) {
		super(username, password, AuthorityUtils.NO_AUTHORITIES);
		this.id = id;
		this.tenantId = tenantId;
		this.userType = userType;
		this.realName = realName;
		this.nickName = nickName;
	}

	public SecurityUser(String username, String password, Collection<? extends GrantedAuthority> authorities) {
		super(username, password, authorities);
	}

	public SecurityUser(String username, String password, boolean enabled, boolean accountNonExpired,
			boolean credentialsNonExpired, boolean accountNonLocked,
			Collection<? extends GrantedAuthority> authorities) {
		super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getRealName() {
		return realName;
	}

	public void setRealName(String name) {
		this.realName = name;
	}

	public String getUserType() {
		return userType;
	}

	public void setUserType(String userType) {
		this.userType = userType;
	}

}
